# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=qtbinpatcher
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.1.0
pkgrel=1
pkgdesc="Patcher for Qt libraries (mingw-w64)"
arch=('any')
url="http://tver-soft.org"
license=("GPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-cmake")
options=('staticlibs' 'strip')
source=(http://tver-soft.org/dl/${_realname}-${pkgver}.tar.bz2
        #"http://sourceforge.net/projects/qtx64/files/external-binaries/qtbinpatcher/2.1.0/qtbinpatcher-2.1.0.tar.bz2/download"
        )
md5sums=('b93d253e6661b27a7c985e6bcf6200f5')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

build() {
  [[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
  mkdir -p ${srcdir}/build-${MINGW_CHOST}
  cd ${srcdir}/build-${MINGW_CHOST}
  
  ${MINGW_PREFIX}/bin/cmake \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${pkgdir}${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    ../${_realname}-${pkgver}
  make
}

package() {
  cd ${srcdir}/build-${MINGW_CHOST}

  make install
}
